<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加联系人</title>

    <meta name="pragma" content="no-cache">
    <meta name="cache-control" content="no-cache">
    <meta name="content-type" content="text/html;charset=UTF-8">
    <meta name="expires" content="0">
    <div th:replace="~{commons/script::script}"></div>
</head>
<style>
    *{
        margin-left: 10px;
        padding: 3px;
    }
    .tip{

        height:30px;
        text-align: right;
        background-color: #F5F5F5;
    }
</style>
<body>
<form id="newCustomer" method="post">
    <input type="hidden" name="customerVO.id" value="${customerVO.id }">
    <input type="hidden" name="customerVO.isDeleted" value="${false}">
    <input type="hidden" name="customerVO.isLocked" value="${false }">
    <input type="hidden" name="customerVO.contactId" value="${customerVO.contactId }">
    <input type="hidden" name="customerVO.contactCreateUserId" value="${customerVO.contactCreateUserId }">
    <input type="hidden" name="customerVO.contactCreateTime" value="${customerVO.contactCreateTime }">
    <input type="hidden" name="customerVO.createUserId" value="${customerVO.createUserId }">
    <input type="hidden" name="customerVO.createTime" value="${customerVO.createTime}">
    <table>
        <tr>
            <td class="tip">姓名：</td>
            <td><input name="name" class="easyui-textbox easyui-validatebox" data-options="required:true"></td>
            <td class="tip">称呼：</td>
            <td><input name="saltname" class="easyui-textbox easyui-validatebox" data-options="required:true"></td>
        </tr>
        <tr>
            <td class="tip">邮箱：</td>
            <td><input name="email" class="easyui-textbox easyui-validatebox" data-options="required:true,validType:'email'"></td>
            <td class="tip">职位：</td>
            <td><input name="post" class="easyui-textbox easyui-validatebox" data-options="required:true"></td>
        </tr>
        <tr>
            <td class="tip">QQ：</td>
            <td><input name="qqno" class="easyui-textbox easyui-validatebox" data-options="required:true,validType:['integer']"></td>
            <td class="tip">手机：</td>
            <td><input name="telephone"  class="easyui-textbox easyui-validatebox" data-options="required:true,validType:['mobile']"></td>
        </tr>
        <tr>
            <td class="tip">备注：</td>
            <td colspan="3">
                <textarea name="description" class="easyui-textbox" data-options="multiline:true" style="width:579px;height:60px;"></textarea>
            </td>
        </tr>

        <tr>
            <td colspan="4" style="text-align: center;">
                <a id="save" href="javascript:void(0);" class="easyui-linkbutton button-purple" >保存</a>
                <a id="submit" href="javascript:void(0);" class="easyui-linkbutton button-pink" >保存并新建</a>
                <input class="easyui-checkbox" type="checkbox" name="" value="">同时创建商机
            </td>
        </tr>
    </table>
</form>
</body>
<script type="text/javascript">
    $(function(){
        //修改回显地址
        var address = "";
        address = address.split("-");
        $("#addr1").textbox({"value":address[0]});
        $("#addr2").textbox({"value":address[1]});
        $("#addr3").textbox({"value":address[2]});
        $("#addr4").textbox({"value":address[3]});

        // $("#submit").on("click",function(e){
        $("#save").on("click",function(e){
            var addr1 = $("#addr1").val();
            var addr2 = $("#addr2").val();
            var addr3 = $("#addr3").val();
            var addr4 = $("#addr4").val();
            var addr = addr1+"-"+addr2+"-"+addr3+"-"+addr4;
            $("#address").val(addr);

            $.post("/contacts/save",
                $("#newCustomer").serialize(),
                function(data){
                        $.messager.alert({
                        title:"提示",
                        msg:data.msg,
                    })
                },"json")

            /*$("#newCustomer").form("submit",{
                url:"/customer/save",
                onSubmit:function(){
                    return $(this).form("validate");
                },

                success:function(data){
                    var tdata=eval("("+data+")");
                    if(tdata&&tdata.success){
                        parent.parent.$("#topWindow").window("close");
                    }
                }
            })*/

        })
    })
</script>
</html>